import {mongo} from "#nuxt-mongodb"
import {ObjectId} from "mongodb"

interface AnimeInter{
    aid:number,
    name:string,
    detail:string,//简介
    image:string, //封面
    url:string//路径
}

interface selectUserMesInter {
    id:string,
    name:string,
    isVip:boolean,
    loveAnime:Array<AnimeInter>

}

export default defineEventHandler(async (event:any)=>{
    const {id,name,isVip,loveAnime}:selectUserMesInter = await readBody(event)
    const objectId = new ObjectId(id)
    const result = await mongo.db().collection('userMes').findOne({id:objectId,name:name});
    // console.log(result)
    return {
        status: 200,
        data: result
    }
})